Implements endings 3 and 4. Final commit before prototype submission