Fixed issue regarding JDK 1.7 backward compatibility (generics)

Refactored some methods

more info:
http://stackoverflow.com/questions/18613562/jdk-1-7-breaks-backward-compatibility-generics