Refactored source, fixed build.gradle