I also prefer way (1). It had the clear definition of functions.
Thanks! :)