added more helper functions, still incomplete