Cleaned up main (still basic, no serial)

Main is a little nicer, so that the functions of functions can be
understood better