added function with bugs