Rewrote solution + added codex