Implemented everything! TODO: Actually test it.

Signed-off-by: Ross Allan <rallanpcl@gmail.com>