finished, cleaning up code