cleaned up code but very buggy