Changed use of generics in order to be compatible with Java 6