placing assignments in correct order