added more helper functions, some incomplete