Implemented the empty functions and tests.

the following lines are heavily nested. a ruby one-liner or refactor might prove useful here.