Review of the logic for a "more Agile" code :P
Added few tests as well