change scancam x key from 'x' to 'X'

Since we are using lowercase 'x' for the original (x,y) coordinates that
the scans are built in, use an uppercase 'X' for the scancam x-axis to
avoid confusion.

Also a bunch of formatting and comment updates and typos
formatting
move scan action into function