created method which takes the number of free places into account