final push of most up to date code (still has to be refactored)