Building main fuctionality