simplify backend
minor fix in type inference
add support for top-level type signatures