Added helper functions and improved general readability