Updated annotations and restored original algorithm