Implemented 'staylogged' function