EAGLESIX-3082: Ported code; cleaned code. Ran test cases.