add some type annotations and get rid of unused function