not sure if works, but making the functions in index better