fixed bug on Controller(long/int) & refinement of code