Edited Max's CS. I'll wait for your approval before posting IC