Cleaning up some functionality