Minor code style improvements.
Implemented first working version of perl script.