fixed parsing integers, simplified controller code