Slimmed down to only use necessary parts