Made a few fixes and added new code for a future gui