fixed most things; adding funcs for testing