adding first steps of program logic and fixing some small bugs