cleaning up and adding more functionality