changed apply procedure case a little to be more understandable