finished coding - still need to debug :(