Fixed bugs in removing friends function, error handling etc.