Refactoring code. Damn I want traits!

Signed-off-by: Ben Corlett <bencorlett@me.com>