Used code from an example, will need to change