More frontend cleanup. Split into multiple files