Rewrote the code, although player movement was stripped.