improved the return datastructure of semaphore