changed some code around