BIG UPDATE

Most functions implemented