SOAP-653: Removed duplicate code and fixed compilation errors