Return error code when failing something
Rearrange code to enable functional testing