reduce the code somemore