clean up and finish basic functionality