added main functions
small fixes