Tried to make API more flexible