Improve algorithms