Main functions implemented