Codegolf entry
Answer v2