Better functions

See test.txt