Completed printing function, added minimal input sanitizing