fully working now with better organization