Main functionalities and logics done