Next priority needs to be some code cleanup because this is already becoming a mess.