Port commented code
Move code to plugin