Version 1

First attempt
Version 2

Fixed last line