Revert "refactor code & add integration tests."

This reverts commit 3cc878bc33a981e5db922336570fcd2126be52d9.