Altered code to remove runtime warnings