solutions copied from dropbox