updated method synchronized to stop race conditions.
udpated the in memory storage to use not found exception.