move logic into __construct