init
almost all functions implemented, tested working