all functions working; test implemented