validate first
minor cleanup
code formatting
minor cleanup