Re-imported refactored source code to be used as an Android Library.