cleaning up functions for better abstraction