Rewrite module to fit needs, fix linter errors