Simplify & Refactor & add tests