Updated code. Started working on translating to Blocks.