added some helper functions and removed debug text