Refactor this shit