this fixes #12 and some style issues