Lots of refactoring. Added spring xml namespace support