adding annotations and solving bugs