Clean a little bit, remove duplicate code