added pre and post conditions for functions for more clear documentation