front: Modularize a bit of code, some cleanup.