cleanup and more functionality