integrated code - minor bug fixes