functions implemented, working