Fixed all test cases and moved compiling from script to controller