Remove unchecked casts, add REPL features