Added comments, modified getCurrentOffset method