fix bug and clean up code
create stage 2-3