cleaned up a lot. still really buggy