Last_online fix and some code cleanup

TODO: image upload