Edited to remove compile warnings