Combined some code