Worked out a few logic errors, however still super buggy