Code refactoring. Also adding support for presence icons