added phases 2-4, testing