Feature/unit tests

@emhr This is a start, take a look and tell me what you think.