updated code to be less dependant on Spring