Better Algorithm - Done