#334 Separated test code

I have separated the test code as requested in #334