slight cleaning of code