Added collision logic and fixed other misc bugs