cleaned up functionality