added code to check if space is taken