Move selected attribute outside class constructor