Done some refactoring and sorted out pacakages.

Signed-off-by: Charlie <chaz2505@hotmail.com>