initial scratch
port first methods from php to js